package com.ruoyi.web.controller.system.Fdongbei;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.system.Fdongbei.domain.TbRfidDes;
import com.ruoyi.system.Fdongbei.service.ITbRfidDesService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 非过磅车辆RFIDController
 * 
 * @author ruoyi
 * @date 2025-01-08
 */
@RestController
@RequestMapping("/system/UNRFID")
public class TbRfidDesController extends BaseController
{
    @Autowired
    private ITbRfidDesService tbRfidDesService;

    /**
     * 查询非过磅车辆RFID列表
     */
    @PreAuthorize("@ss.hasPermi('system:UNRFID:list')")
    @GetMapping("/list")
    public TableDataInfo list(TbRfidDes tbRfidDes)
    {
        startPage();
        List<TbRfidDes> list = tbRfidDesService.selectTbRfidDesList(tbRfidDes);
        return getDataTable(list);
    }

    /**
     * 导出非过磅车辆RFID列表
     */
    @PreAuthorize("@ss.hasPermi('system:UNRFID:list')")
    @Log(title = "非过磅车辆RFID", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbRfidDes tbRfidDes)
    {
        List<TbRfidDes> list = tbRfidDesService.selectTbRfidDesList(tbRfidDes);
        ExcelUtil<TbRfidDes> util = new ExcelUtil<TbRfidDes>(TbRfidDes.class);
        util.exportExcel(response, list, "非过磅车辆RFID数据");
    }

    /**
     * 获取非过磅车辆RFID详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:UNRFID:list')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tbRfidDesService.selectTbRfidDesById(id));
    }

    /**
     * 新增非过磅车辆RFID
     */
    @PreAuthorize("@ss.hasPermi('system:UNRFID:list')")
    @Log(title = "非过磅车辆RFID", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TbRfidDes tbRfidDes)
    {
        return toAjax(tbRfidDesService.insertTbRfidDes(tbRfidDes));
    }

    /**
     * 修改非过磅车辆RFID
     */
    @PreAuthorize("@ss.hasPermi('system:UNRFID:list')")
    @Log(title = "非过磅车辆RFID", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TbRfidDes tbRfidDes)
    {
        return toAjax(tbRfidDesService.updateTbRfidDes(tbRfidDes));
    }

    /**
     * 删除非过磅车辆RFID
     */
    @PreAuthorize("@ss.hasPermi('system:UNRFID:list')")
    @Log(title = "非过磅车辆RFID", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbRfidDesService.deleteTbRfidDesByIds(ids));
    }
}
